<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
		<style type="text/css">
			.active{
				color: red;
			}
		</style>
	</head>
	<body>
			<ul>
				<li id="1">2222</li>
				<li id="2">2222</li>
				<li id="3">2222</li>
				<li id="4">2222</li>
				<li id="5">2222</li>
			</ul>
			<script>
				 $("li").on("click",function(){
				 	 $id=$(this).attr("id");
                     $(this).addClass("active");
                     $(this).siblings("li").removeClass("active");
				 })
				 
				 var $$id=$(".active").attr("id");
				 alert($$id);

				
				
			</script>
	</body>
</html>
